/*
 * Constant.java	2008/07/28
 *
 * Copyright 2008 Web & Zen Multimedia, All rights reserved.
 * Use is subject to license terms.
 */
package it.wzm.lightweightlog;


import java.text.SimpleDateFormat;

/**
 * This interface serve is a placeholder for all the variable of the application
 * @author Leonardo Celati
 * @version 1.0
 */
public interface Constant {

	/** Possible object type */
	enum Type {
		DUMPER("dumper"),
		REGISTER("register"),
		LOGPOOL("logpool"),
		QUEUE("queue"),
		QUEUEDUMPER("queuedumper"),
		ENTRY("entry");
		
		private String descr;
		
		Type(String descr) {
			this.descr=descr;
		}
		
		/** Return type description */
		public String getDescr() {
			return this.descr;
		}
	}

    /**
     * Represents status of the Log
     * @author Leonardo Celati
     */
    public enum Status {
    	/** off */
    	OFF(0),
        /** Initialization mode */
        INIT(1),
        /** Running mode */
        RUNNING(2),
        /** Sleeping mode */
        SLEEPING(3),
        /** Shutdown mode */
        SHUTDOWN(4), 
        /** Initialization failed*/
        FAILURE(5),
    	/** Object disabled */
    	DISABLED(6);
        
        private int value;
        
        Status( int value) {
        	this.value=value;
        }
        
        public int getValue() {
        	return this.value;
        }
    }    
    
    /** Enum representing all possible Severity log level */
    enum Severity {
    	SERVICE((short)0),/** service log level */
        DEBUG((short)1),	/** debug log level */
        INFO((short)2),	/** info log level  */
        WARN((short)3),	/** warn log level  */
        ERROR((short)4),	/** error log level */
        FATAL((short)5);	/** fatal log level */
        
        private short level;
    	
    	Severity(short level) {
    		this.level=level;
    	}
    	
    	public short getLevel() {
    		return this.level;
    	}
    }
    
    /** Current version */
    public String VERSION="1.0.1";
    /** The default file name in case a custom one is missing */
    public String PROP_DEFAULT = "META-INF/dump_default.properties";
    /** The name the custom file has to have */
    public String PROP_NAME="dumper.properties";
    /** The root of all the others properties */
    public String PROP_ROOT = "dumper.";
    /** default implementation of Log */
    public String DEFAULT_LOG = "it.wzm.lightweightlog.Log";    
    /** default implementation of Queue */
    public String DEFAULT_QUEUE = "it.wzm.lightweightlog.FastQueue";
    /** Default implementation of Register */
    public String DEFAULT_REGISTER = "it.wzm.lightweightlog.DefaultRegister";
    /** Default implementation of Register */
    public boolean DEFAULT_REGISTER_PARALLEL=false;    
    /** Default implementation of Queue dumper */
    public String DEFAULT_QUEUE_DUMPER = "it.wzm.lightweightlog.QueueDumper";
    /** default log wrapper */
    public String DEFAULT_ENTRY = "it.wzm.lightweightlog.Entry";
    /** default dump interval */
    public long DEFAULT_DUMP_INTERVAL = 5000;
    /** default size rotation */
    public long DEFAULT_SIZE = 10000;
    /** default prepared statement for DBDumper */
    public String DEFAULT_PREPARED_STMT = "INSERT INTO lightweightlog_dump (event, message, severity, classname, name) VALUES (?,?,?,?,?)";
    /** default behavior on failure */
    public boolean DEFAULT_KILL_ON_FAILURE = true;
    /** default keep alive */
    public boolean DEFAULT_KEEP_ALIVE = false;
    /** default format of date in log */
    public SimpleDateFormat DEFAULT_LINE_DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
    /** default encoding */
    public String DEFAULT_ENCODING = "UTF-8";
    /** Buffer for RemoteDumper */ 
	public int DEFAULT_MAXBUFFER = 0;
	/** Interval in msec before the SynchronizedQueue will make QueueDumper wait...	 */
	public long DEFAULT_SINCHRONIZED_QUEUE_TIMEOUT = 5000;
	/** default LogPool */
	public String DEFAULT_POOL = "it.wzm.lightweightlog.SoftLogPool";        
	/** default max percentage number of Entry to get from the Queue */
	public int DEFAULT_QUEUE_MAX_RETAIN=20;
	/** default serialzie */
	public boolean DEFAULT_SERIALIZE=true;
	
}
